package com.kara.woodAgent.agent.wood.model;

import com.kara.woodAgent.common.exception.BizException;
import lombok.Data;

/**
 * @author tzy
 * @version 1.0
 * @project wood_agent
 * @description
 * @date 2025/6/9 11:16:28
 */
@Data
public class Plan {

	public static String DISPATCH = "dispatch";

	public static String RUNNING = "running";

	public static String SUCCESS = "success";

	public static String FAIL = "fail";


	private Integer id;

	private String content;

//	private String agentName;

	private String resultMsg;

	private String status;






	public void running() {
		if(!DISPATCH.equals(this.status)){
			throw new BizException("状态转换异常：    状态为：" + this.status + "  不能转换为 running");
		}
		this.status = RUNNING;
	}

	public void success() {
		if(!RUNNING.equals(this.status)){
			throw new BizException("状态转换异常：    状态为：" + this.status + "  不能转换为 success");
		}
		this.status = SUCCESS;
	}

	public void fail() {
		if(!RUNNING.equals(this.status)){
			throw new BizException("状态转换异常：    状态为：" + this.status + "  不能转换为 fail");
		}
		this.status = FAIL;
	}
}
